package com.example.dlmanager;

import android.app.Activity;
import android.os.Bundle;
import android.os.StrictMode;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.example.dlmanager.CoolHttpClient.ResultEntity;

public class MainActivity extends Activity {
	private Button btn = null;
	private String str = "{\"p7\":\"1,游戏汇;\",\"h11\":\"\",\"p6\":[1],\"h12\":3,\"p5\":1,\"h13\":\"com.mel.choice.app.v1\",\"p4\":\"20141219104825\",\"h14\":\"MT6589\",\"p3\":-1,\"h33\":\"mt6589\",\"h15\":\"ALPS.JB2.MP.V1.2\",\"p2\":30,\"h34\":2,\"h16\":1,\"p1\":44,\"h17\":0,\"h18\":\"43060\",\"h30\":1032492,\"h31\":154608,\"h32\":143240,\"p9\":1417076677,\"p8\":46,\"h10\":\"867936010120019\",\"Action\":\"3400\",\"h19\":\"27550482\",\"h24\":\"vigor89_et_jb2\",\"h25\":\"alps\",\"h22\":\"vigor89_et_jb2\",\"h23\":\"vigor89_et_jb2\",\"h28\":17,\"h29\":987296,\"h26\":\"alps\",\"h27\":\"4.2.1\",\"h07\":\"R001_00UITEST\",\"p10\":39600,\"h06\":\"f1\",\"h05\":\"shys1801\",\"h04\":\"1.0.0.0\",\"h20\":\"+8613800210500\",\"h03\":\"Choice_1.mel.0.32588.141112\",\"h21\":\"720*1280\",\"h02\":32588,\"h01\":\"com.mel.choice.app.v1\",\"h08\":\"460001842630792\",\"h09\":\"898600760913f8012440\"}";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build()); 
		 StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() 
		.detectLeakedSqlLiteObjects().penaltyLog().penaltyDeath().build());
		
		btn = (Button)findViewById(R.id.sendrq);
		btn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				 String data = "huangli";
				 byte bytedata[] = data.getBytes();
				for(int i = 0 ; i < bytedata.length; i++){
					Log.i("tag", ""+bytedata[i]);
				}
				ResultEntity result = CoolHttpClient.postEntity( UrlUtil.getDataServerUrl() , str );
				if( result.exception != null )
				{
					Log.v( "COOL" , "GameRemitUpdate rsp:(error)" + result.httpCode + " " + result.exception );
					
				}
				Log.v( "COOL" , "GameRemitUpdate rsp:" + result.httpCode + " " + result.content );
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
